<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<title>${aier_title}</title>
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/jq.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/multiselect.css" />
<link rel="stylesheet" href="${aier_css_url}jc/chosen.css">
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/btn.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/reset.css" />
<link rel="stylesheet" href="${aier_css_url}social/user/ujscb.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/uploadphoto.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/xxs.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}${aier_jqui_js}ui.js"></script>
<script type="text/javascript" src="${aier_js_url}97/WdatePicker.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/ja.js"></script>
<script type="text/javascript" src="${aier_js_url}jc/cj.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/afu.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/multiselect.js"></script>
<script type="text/javascript" src="${aier_js_url}social/user/userHSConBook/teabook.js"></script>

</head>
<script type="text/javascript">
	var global_suffix = "${aier_suffix}", global_url = "${aier_url}", global_uri = "${aier_uri}", global_urijs = "${aier_urijs}", 
		global_sid = "${sid}",global_cid = "${cid}", global_tid = "${tid}",global_userin_url = "${video_user_in_url}",global_userout_url = "${video_user_out_url}";
</script>
<body data-usertype="班主任" class="view-ujscb">

	<!-- 顶栏 -->
	<s:action name="userhomecomm_homeHead" namespace="/user"
		executeResult="true"></s:action>

	<div class="window-content">

		<!-- wrap  -->

		<div class="wrap clearfix">


				
			<!-- 左侧导航栏  -->
			<div class="nav-side">
				<!-- 家校联系簿（班主任） 头像 -->
				<div class="ujscb-userinfo">
					<dl class="clearfix">
						<dt style="" data-log="头像" class="avatar">
							<a href="${aier_url}user/uccomm_userCenter.shtml"> <img src="${get_picturl_url}small/${userInfo.headimg}"></a>
						</dt>
						<dd class="nickname">
							<a href="${aier_url}user/uccomm_userCenter.shtml">${userInfo.nickname}</a>
						</dd>
						<dd>
						    <div class="explain">
                                <span id = "mesCount"></span>
                            </div>
						</dd>
					</dl>
				</div>
				<!-- / 管理员头像 -->

				
			</div>
			<!-- // 左侧导航栏  -->

			<!-- 主区域 (右  -->
			<div class="main-area clearfix">

				<!-- 中间栏 -->
				<div class="message-stream">
					<div class="stream-main">
						<div class="right-main-top">
							<div class="binfo-title" id="title">
								<h3>家校联系簿</h3>
							</div>
						</div>
						<div class="sendBox">
							<div id="teaSendTabs">
								<ul>
									<li><a href="#inputTalk">对话</a></li>
									<li><a href="#inputTask">作业</a></li>
									<li><a href="#inputBroadcast">公告</a></li>
									<li><a href="#inputRemark">评语</a></li>
								</ul>
								<!-- 对话 -->
								<div id="inputTalk">
									<div class="sendto clearfix">
										<span class="send-to-left">发送给：</span>
										<div class="send-to-right">
											<select id="sendDialogue" style="width:205px;" multiple="multiple">
												<c:forEach var="sg" items="${csList }">
													<option value="${sg.uid}">${sg.sname}</option>
												</c:forEach>
											</select>
										</div>
									</div>
									<div class="input-box clearfix">
										<textarea class="placeholder" id="dialogText"
											placeholder="对话可以发给多个家长了，内容只有您和对方可见。" data-maxcount="120"
											data-input-limit-uid="0" data-prevcolor="rgb(0, 0, 0)"
											style="color:#515151;"></textarea>
										<div class="input-bottom clearfix">
											<span class="fr word-limit" style="visibility: hidden;">"还可以输入"<em>114</em>"个字"</span>
											<span class="doupload" style="visibility: hidden;"> <a
												href="javascript:;" class="upload_img">图片</a>&nbsp;| <a
												href="javascript:;" class="upload_video">视频</a>&nbsp;| <a
												href="javascript:;" class="upload_attach">附件</a> </span>
										</div>
									</div>
									<div class="sendOth">
										<a href="javascript:;" id="dialogSend" class="button sendBtn"><em>发送</em>
										</a>
									</div>
								</div>
								<!-- 作业 -->
								<div id="inputTask">
									<div class="input-box clearfix">
										<textarea class="placeholder" id="homeworkText"
											placeholder="作业会同步显示在班级黑板和作业公示栏里哦~" maxcount="240"
											data-input-limit-uid="1" data-prevcolor="rgb(0, 0, 0)"
											style="color:#515151;"></textarea>
									</div>
									<div class="input-bottom clearfix">
										<span class="fr word-limit" style="visibility: hidden;">还可以输入<em>240</em>个字</span>
										<span class="doupload"> 
										
										<a href="javascript:;"
											class="upload_img">图片</a>
											
											 <!-- &nbsp;| --> 
											 
											 <a
											href="javascript:;" class="upload_video"
											style="visibility: hidden;">视频</a> 
											
											<a href="javascript:;"
											class="upload_attach" style="visibility: hidden;">附件</a> 
											
										</span>
										

										
										<div style="display: none;" class="upload_oper_panel">
											<div class="inner_panel img_panel" style=""></div>
										</div>
									</div>
									<div class="sendOth">
									    <input id="sendHomeworkMsg" type="checkbox" value=""> <label
                                            for="sendPhoneMsg">同时发送免费手机短信</label>
										<a href="javascript:;" id="homeworkSend"
											class="button sendBtn"><em>发送</em> </a>
									</div>
								</div>
								<!-- 公告 -->
								<div id="inputBroadcast">
									<div class="input-box clearfix">
										<textarea class="placeholder" id="schoolmessageText"
											placeholder="公告会同步显示在班级黑板上哦！"
											maxcount="240" data-input-limit-uid="1"
											data-prevcolor="rgb(0, 0, 0)"
											style="color:#515151;"></textarea>
									</div>
									<div class="input-bottom clearfix">
										<span class="fr word-limit" style="visibility: hidden;">还可以输入<em>240</em>个字</span>
										<span class="doupload"> <a href="javascript:;"
											class="upload_img">图片</a> <!-- &nbsp;| --> <a
											href="javascript:;" class="upload_video"
											style="visibility: hidden;">视频</a> <a href="javascript:;"
											class="upload_attach" style="visibility: hidden;">附件</a> </span>
										<div style="display: none;" class="upload_oper_panel">
											<div class="inner_panel img_panel" style=""></div>
										</div>
									</div>
									<div class="sendOth">
										<input id="sendPhoneMsg" type="checkbox" value=""> <label
											for="sendPhoneMsg">同时发送免费手机短信</label>
										<a href="javascript:;" id="schoolmessageSend"
											class="button sendBtn"><em>发送</em> </a>
									</div>
									 
								</div>
								<!-- 评语 -->
								<div id="inputRemark">
									<div class="sendto clearfix">
										<span class="send-to-left">发送给：</span>
										<div class="send-to-right">
											<select id="sendComment" style="width:205px;" multiple="multiple">
												<c:forEach var="sg" items="${csList }">
													<option value="${sg.uid}">${sg.sname}</option>
												</c:forEach>
											</select>
										</div>
									</div>
									<div class="input-box clearfix">
										<textarea class="placeholder" id="commentText"
											placeholder="评语是私密的，学生评语仅自身可见。" data-maxcount="120"
											data-input-limit-uid="0" data-prevcolor="rgb(0, 0, 0)"
											style="color:#515151;"></textarea>
									</div>
									<div class="input-bottom clearfix">
										<span class="fr word-limit">还可以输入<em>115</em>个字</span>
										<h3>示范评语(试试直接选择下面的评语吧，可以多选哦)</h3>
									</div>
									<div class="remarks">
										<div class="box">
											<ul id="demoRemark">
												<li><a href="javascript:;">老师喜欢你上课的专心劲，同学们羡慕你遥遥领先的成绩。</a>
													<a href="javascript:;">学海无涯，山外有山，希望你在以后的日子里一如既往。</a> <a
													href="javascript:;">上课你总是那么全神贯注；</a> <a href="javascript:;">作业你总是做得完美无缺；</a>
													<a href="javascript:;">值日你总是竭尽全力！</a> <a
													href="javascript:;">你喜欢读书，所以作文总是妙笔生花。</a> <a
													href="javascript:;">你活泼开朗，所以心情总是快乐舒畅。</a> <a
													href="javascript:;">你热爱学习，所以发言总是正确响亮。</a> <a
													href="javascript:;">你活泼开朗，每天都有灿烂的笑容。</a> <a
													href="javascript:;">你善于思考，做事仔细，作业工整。</a> <a
													href="javascript:;">待老师和同学你也很热情、真诚。</a> <a
													href="javascript:;">你非常关心班集体。</a> <a href="javascript:;">有着良好的行为习惯。</a>
													<a href="javascript:;">老师喜欢看到你甜甜的笑脸！</a> <a
													href="javascript:;">你热情洋溢，精力充沛。</a> <a href="javascript:;">以你天马行空的想象力，一定可以成为大才子。</a>
													<a href="javascript:;">你思维敏捷，头脑灵活。</a> <a
													href="javascript:;">你课堂上的发言很精彩。</a> <a href="javascript:;">老师经常为你非凡的创想而叹服。</a>
													<a href="javascript:;">你能团结同学，礼貌待人，关心集体。</a> <a
													href="javascript:;">你是关心集体的好同学。</a> <a href="javascript:;">热爱劳动的好同学。</a>
													<a href="javascript:;">你是认真学习的好榜样。</a> <a
													href="javascript:;">认真负责的班干部。</a> <a href="javascript:;">你是乖巧可爱的小精灵。</a>
												</li>
												<li style="display: none;"><a href="javascript:;">希望你多关心集体的荣誉。</a>
													<a href="javascript:;">希望你可以当好老师的助手。</a> <a
													href="javascript:;">你身上有许多闪光的地方。</a> <a href="javascript:;">我们每天不妨对自己说一句‘我能行’。</a>
													<a href="javascript:;">努力吧，美好的明天属于你！</a> <a
													href="javascript:;">只要不断拼搏，你一定会比现在更加出色。</a> <a
													href="javascript:;">你一直在知识的山路上，勤勤恳恳的攀登着。</a> <a
													href="javascript:;">老师终于看到了这颗宝石重放异彩了。</a> <a
													href="javascript:;">你必须像运动员在比赛场上一样，向着目标奋力冲刺。</a> <a
													href="javascript:;">这学期你各方面的表现都很不错，学习成绩稳步提高。</a> <a
													href="javascript:;">相信你能靠实力做一个出类拔萃的人。</a> <a
													href="javascript:;"> “天下无难事，只怕有心人”</a> <a
													href="javascript:;">老师期待你取得更大的进步。</a> <a
													href="javascript:;">书山有路勤为径，学海无涯苦作舟！</a></li>
												<li style="display: none;"><a href="javascript:;">没有人可以不劳而获，没有人不需要战胜懒惰。</a>
													<a href="javascript:;">你需要一颗坚韧的心，不断催促自己前行。</a> <a
													href="javascript:;">每天，我们可以问自己，‘我努力了吗？’</a> <a
													href="javascript:;">只要努力，老师相信，你一定能行！</a> <a
													href="javascript:;">下学期你可否远离‘粗心’、‘多动’呢？</a> <a
													href="javascript:;">老师相信：你会更加优秀的！</a> <a
													href="javascript:;">学习不能仅仅停留表面，还要进行更深层次的钻研。</a> <a
													href="javascript:;">希望你能赶走“调皮”，老师相信你会变得更聪明。</a> <a
													href="javascript:;">要试着学习控制情绪。</a> <a href="javascript:;">性格内向不是大问题，多和同学交流就可以！</a>
													<a href="javascript:;">规律做事，有始有终。</a> <a
													href="javascript:;">多锻炼就不会那么娇气。</a> <a href="javascript:;">让自己的心静下来。</a>
												</li>
											</ul>
										</div>
									</div>
									<div class="sendOth">
									    <input id="sendCommentMsg" type="checkbox" value=""> <label
                                            for="sendPhoneMsg">同时发送免费手机短信</label>
										<a href="javascript:;" id="commentSend" class="button sendBtn"><em>发送</em>
										</a>
									</div>
								</div>

							</div>



							<div id="teaShowTabs">
								<ul>
									<li><a href="#userDialogue" id = "dialogli">对话</a></li>
									<li><a href="#userTask" id = "task" >作业</a></li>
									<li><a href="#userBulletin" id = "bulletin">公告</a></li>
									<li><a href="#userRemark" id = "remark">评语</a></li>
									<!--  <li><a href="#userDailyDining" id = "daily">每日餐饮</a></li>-->
									<li><a href="#userParkRecord" id = "record">进出园记录</a></li>
								</ul>
								<!-- 公告 -->
								<div id="userBulletin">
								</div>
								<!-- 作业 -->
								<div id="userTask">
									<div class="fd-item" id = "homework">
										
									</div>
								</div>
								<!-- 每日餐饮 -->
								<!--  <div id="userDailyDining">功能完善中,敬请期待</div>-->
								<!-- 对话 -->
								<div id="userDialogue">
									<!-- <div class="fd-item clearfix">
										<a href="javascript:;" style="float: left;"
											class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
											role="button" aria-disabled="false"><span
											class="ui-button-text">全部</span> </a>

										<div class="item-stu-sel">
											<table>
												<tr>
													<td class="gray6">选择单个学生：</td>
													<td><select id="diaStuSel"
														data-placeholder="请选择或输入学生姓名" Class="chosen" tabindex="1">
															<c:forEach var="sg" items="${csList }">
																<option value="${sg.uid}">${sg.sname}</option>
															</c:forEach>
													</select></td>
												</tr>
											</table>
										</div>

									</div> -->
									<div class="fd-item" id="dialog">
									</div>
								</div>
								<!-- 评语 -->
								<div id="userRemark">
									<!--  <div class="fd-item clearfix">


										<a href="javascript:;" style="float: left;"
											class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
											role="button" aria-disabled="false"><span
											class="ui-button-text">全部</span> </a>

										<div class="item-stu-sel">
											<table>
												<tr>
													<td class="gray6">选择单个学生：</td>
													<td><select id="remStuSel"
														data-placeholder="请选择或输入学生姓名" Class="chosen" tabindex="1">
															<c:forEach var="sg" items="${csList }">
                                                                <option value="${sg.uid}">${sg.sname}</option>
                                                            </c:forEach>
													</select></td>
												</tr>
											</table>
										</div>

									</div>-->
									<div class="fd-item" id = "appraise">
										
									</div>
								</div>

								<!-- 进出园记录 -->
								<div id="userParkRecord">
									<table id="inOutParkInfo"></table>
									<div id="inOutParkPage"></div>
								</div>

							</div>
						</div>
					</div>
					<div id = "page"></div>
				</div>

				
			</div>
			<!-- 回到顶部 -->
			<s:action name="userhomecomm_backToTop" namespace="/user" executeResult="true"></s:action>

		</div>
		<!-- footer copyright -->
		<s:action name="userhomecomm_homeFooter" namespace="/user" executeResult="true"></s:action>
		<!-- /footer copyright -->
	</div>
<!-- 上传图片弹出框 -->
<div id="uploadPhotoBox" style="z-index:999;display:none;">
	<div class="title">上传图片</div>

	<div class="select">

		<a class="btn-select">
			<label for="selectPhoto">
			<span>选择图片</span>
			</label>
		</a>

		<input type="file" id="selectPhoto" style="" name="selectPhoto">
	</div>

	<div class="uploading" style="display:none">正在上传</div>

	<div id="confirmPhoto" style="display:none">
		<div id="photoName"></div>
		<div id="delete">x</div>
	</div>

</div>
<!-- /上传图片弹出框 -->

<div id="deleteConfirm" style="display: none;" title="删除">
    <p>你确定要删除这条公告吗?</p>
</div>

</body>


<script type="text/javascript">
var bpage = 1;       // 公告的当前页
var tpage = 1;       // 作业的当前页
var dpage = 1;       // 对话的当前页
var rpage = 1;       // 评语的当前页
var page_size = 10;  // 每页的记录数

var cname = "${cname}"; // 班级名称

var curTab = 0;      // 当前选中的是哪个标签页（0对话1作业2公告3评语4进出园记录）

var hwImg = "";
$("#teaSendTabs").tabs();
$("#teaShowTabs").tabs();
$(".chosen").chosen();

//设置班级为下拉复选框
$("#sendDialogue").multiselect({
	noneSelectedText : "请选择",
	selectedText : "已选中#个学生",
	selectedList : 3
});

//设置班级为下拉复选框
$("#sendComment").multiselect({
	noneSelectedText : "请选择",
	selectedText : "已选中#个学生",
	selectedList : 3
});

//同步加载用户所管理的班级列表

//同步加载用户所绑定的宝宝

//文本输入框与textare切换
//文本框获得焦点
$(".txt_ipt").focus(function() {
	$(this).hide();
	$(this).closest('.fd-right').find('.comment_input_box').show();
	$(this).closest('.fd-right').find('.comment_input_box textarea').focus();
});

$(document)
		.ready(
				function() {
					var fun = function(data) {
                        if (data.s == 1) {
                            var ct = data.ct;
                            if (ct == null) {
                                $().message("您没有权限进入此家校联系薄");
                                window.history.back();
                            } else {
                                global_tid = ct.tid;
                                $("#title").html("<h3>家校联系薄-" + cname + "</h3>");
                                if (data.method == 2) {
                                   $("#mesCount").text("剩余短信"+data.mesCount+"条");
                                }
                                // 获取对话列表
                                searchDialog(dpage);
                            }
                        }
                    };
                    exeAjax(
                            ajaxUrl("${aier_url}${aier_urijs}userhscb_searchTeacherByCidUid${aier_suffix}"),
                            fun, {
                                "cid" : global_cid,
                                "tid":global_tid
                            });
				});
// 教师发送对话
$("#dialogSend")
		.click(
				function() {
					var buidStrOld = $("#sendDialogue").val();
                    var buidStr = "" ;
                    if (buidStrOld != null) {
                        buidStr = buidStrOld.toString();
                    }
					if (isnull(buidStr)) {
						$().message("请选择学生！");
						return;
					}
					var content = $("#dialogText").val();
					if (null == content || "" == content) {
						$().message("请输入对话内容！");
						return;
					}
					var fun = function(data) {
						if (data.s == 1) {
							$("#sendDialogue").attr("value", "");
							$("#sendDialogue").multiselect('refresh');
							$("#dialogText").val("");
							$().message("对话发送成功！");
							// 刷新对话列表
							searchDialog(dpage);
						}
					};
					exeAjax(
							ajaxUrl("${aier_url}${aier_urijs}userhscb_launchTDialog${aier_suffix}"),
							fun, {
								"tid" : global_tid,
								"cid" : global_cid,
								"buidStr" : buidStr,
								"content" : content
							});

				});
// 教师发布作业
$("#homeworkSend")
		.click(
				function() {

					var content = $("#homeworkText").val();
					if (isnull(content)) {
						$().message("请输入作业内容！");
						return;
					}
					var isSendPhone = false;
					if ($('#sendHomeworkMsg').attr("checked") == "checked") {
                        isSendPhone = true;
                    }

					var fun = function(data) {
						if (data.s == 1) {
							$("#homeworkText").val("");
							hwImg = "";
			                $('#confirmPhoto').hide();
			                $('#selectPhoto').val("");
			                $('#photoName').html("");
			                $("#sendHomeworkMsg").attr("checked",false);
			                $('.select').show();
							$().message("作业发布成功！");
							$("#mesCount").text("剩余短信"+data.mesCount+"条");
							// 刷新作业列表
                            searchHomework(tpage);
						} else if (data.s == 2) {
						    $().message("剩余短信数量不足，短信发送失败！");
                            $("#homeworkText").val("");
                            hwImg = "";
                            $('#confirmPhoto').hide();
                            $('#selectPhoto').val("");
                            $('#photoName').html("");
                            $("#sendHomeworkMsg").attr("checked",false);
                            $('.select').show();
                            // 刷新作业列表
                            searchHomework(tpage);
						}
					};
					exeAjax(
							ajaxUrl("${aier_url}${aier_urijs}userhscb_commitHomework${aier_suffix}"),
							fun, {
								"tid" : global_tid,
								"cid" : global_cid,
								"imageName" : hwImg,
								"content" : content,
								"isSendPhone":isSendPhone
							});

				});
				
// 教师发布公告
$("#schoolmessageSend")
		.click(
				function() {
					var content = $("#schoolmessageText").val();
					if (null == content || "" == content) {
						$().message("请输入公告内容!");
						return;
					}
					var isSendPhone = false;
					if ($('#sendPhoneMsg').attr("checked") == "checked") {
                        isSendPhone = true;
                    }
					var fun = function(data) {
						if (data.s == 1) {
							$("#schoolmessageText").val("");
							hwImg = "";
							$('#sendPhoneMsg').attr("checked",false);
			                $('#confirmPhoto').hide();
			                $('#selectPhoto').val("");
			                $('#photoName').html("");
			                $('.select').show();
							$().message("公告发布成功!");
							$("#mesCount").text("剩余短信"+data.mesCount+"条");
							searchSchoolMessage(bpage);
						} else if (data.s == 2) {
                            $().message("剩余短信数量不足，短信发送失败！");
                            $("#schoolmessageText").val("");
                            hwImg = "";
                            $('#sendPhoneMsg').attr("checked",false);
                            $('#confirmPhoto').hide();
                            $('#selectPhoto').val("");
                            $('#photoName').html("");
                            $('.select').show();
                            searchSchoolMessage(bpage);
                        }else{
							$().message("公告发布失败!"+data.error_info);
						}
					};
					exeAjax(
							ajaxUrl("${aier_url}${aier_urijs}userhscb_addSchoolMessage${aier_suffix}"),
							fun, {
								"tid" : global_tid,
								"cid" : global_cid,
								"imageName" : hwImg,
								"content" : content,
								"isSendPhone":isSendPhone
							});

		});
		
// 教师发送评语
$("#commentSend")
		.click(
				function() {
					var buidStrOld = $("#sendComment").val();
                    var buidStr = "" ;
                    if (buidStrOld != null) {
                        buidStr = buidStrOld.toString();
                    }
                    if (isnull(buidStr)) {
                        $().message("请选择学生！");
                        return;
                    }

					var content = $("#commentText").val();
					if (null == content || "" == content) {
						$().message("请输入评语内容！");
						return;
					}
					
					var isSendPhone = false;
                    if ($('#sendCommentMsg').attr("checked") == "checked") {
                        isSendPhone = true;
                    }

					var fun = function(data) {
						if (data.s == 1) {
							$("#sendComment").attr("value", "");
							$("#sendComment").multiselect('refresh');
							$("#commentText").val("");
							$("#sendCommentMsg").attr("checked",false);
							$().message("评语发送成功！");
							$("#mesCount").text("剩余短信"+data.mesCount+"条");
							// 刷新评语列表
                            searchAppraise(rpage);
						} else if(data.s == 2) {
						    $().message("剩余短信数量不足，短信发送失败！");
						    $("#sendComment").attr("value", "");
                            $("#sendComment").multiselect('refresh');
                            $("#commentText").val("");
                            $("#sendCommentMsg").attr("checked",false);
                            // 刷新评语列表
                            searchAppraise(rpage);
						}
					};
					exeAjax(
							ajaxUrl("${aier_url}${aier_urijs}userhscb_launchAppraise${aier_suffix}"),
							fun, {
								"tid" : global_tid,
								"cid" : global_cid,
								"buidStr" : buidStr,
								"content" : content,
								"isSendPhone":isSendPhone
							});

				});
$("#dialogli").click(function() {
    curTab = 0;
    searchDialog(dpage);
});
// 获取对话列表
function searchDialog(nowdpage) {
	//dialog
	dpage = nowdpage;
	var fun = function(data) {
		if (data.s == 1) {
			// 刷新对话列表
			var html = "";
			if (data.dialogList != null) {
				for ( var i = 0; i < data.dialogList.length; i++) {
					var dialog = data.dialogList[i];
					html += '<dl class="dldldl clearfix" data-srxtype="talk" data-uid=""><dt><a class="fd-actor" href=""><img width="50" height="50" data-card="392166" src="${get_picturl_url}small/'+dialog.headimg+'"></a></dt>';
					html += '<dd class="fd-right" data-did="'+dialog.did+'">';
					if (dialog.type == 1) {
						html += '<div class="fd-top"><a href="">'
								+ dialog.tname + '老师</a> 发送给 <a href="">'
								+ dialog.bname + '</a> 家长的对话<br>'
								+ dialog.content + '</div>';
					} else {
						html += '<div class="fd-top"><a href="">'
								+ dialog.bname + dialog.relation
								+ '</a> 发送给 <a href="">' + dialog.tname
								+ '老师</a>的对话<br>' + dialog.content
								+ '</div>';
					}
					html += '<div class="fd-media-pre"></div><p class="fd-bottom"><span class="fd-actions"><a href="javascript:;" data-action="replyIt" id="replyCount_1399030" data-count="4">回复(<em>'
							+ dialog.dcList.length
							+ '</em>)</a></span><span class="time">'
							+ dialog.cdate.split("T")[0]
							+ " "
							+ dialog.cdate.split("T")[1] + '</span></p>';

					if (dialog.dcList != null && dialog.dcList.length != 0) {
						html += '<div id="commentPanel_1399030" class="comment"><div id="commentList_1399030" class="comment_list">';
						for ( var j = 0; j < dialog.dcList.length; j++) {
							var dc = dialog.dcList[j];
							html += '<dl><dt><a href=""><img src="${get_picturl_url}small/'+dc.headimg+'" width="40" height="40" data-card="" alt=""></a></dt><dd class="ml50"><a href="">'
									+ dc.cname
									+ '</a><span class="time">'
									+ dc.cdate.split("T")[0]
									+ " "
									+ dc.cdate.split("T")[1] + '</span>';
							html += '<a href="javascript:;" data-action="replyComment" data-cid="282337" data-cuid="" data-fromuser="" class="reply">回复</a><div class="content mt5"><div>'
									+ dc.content
									+ '</div><div class="media_pre"></div></div></dd></dl>';
						}
						html += '</div>';
					}
					html += '<div class="sj"></div><input type="text" class="txt_ipt" value="我要回复" data-action="showInputBox"><div style="display: none;" class="comment_input_box"><div class="txt_wrap"><textarea></textarea></div><div class="after_text"><a data-action="reply" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only fr" role="button" aria-disabled="false"><span class="ui-button-text">发表</span></a></div></div></div></dd></dl>';

				}
			}
			
			$("#dialog").html(html);
			$(".txt_ipt").focus(function() {
				$(this).hide();
				$(this).closest('.fd-right').find(".comment_input_box").show();
				$(this).closest('.fd-right').find('.comment_input_box textarea').focus();
			});
			
			// 对话回复

            $('.fr').click(function() {
               var did = $(this).closest('.fd-right').attr("data-did");
               var content = $(this).closest('.fd-right').find('.comment_input_box textarea').val();

                if (isnull(content)) {
                    $().message("请输入回复内容！");
                    return;

                }
                var fun = function(data) {
		            if (data.s == 1) {
		                $("#dcText").val("");
		                // 刷新对话列表
		                searchDialog(dpage);
		            }
		        };
		        exeAjax(
	                ajaxUrl("${aier_url}${aier_urijs}userhscb_commentDialog${aier_suffix}"),
	                fun, {
	                    "did" : did,
	                    "type" : 1,
	                    "content" : content,
	                    "tid":global_tid
	                });
               
            });
            // 更新分页显示
            if (curTab == 0) {
                dpage = data.page;
                toLoadPage(dpage, page_size, data.page_count, data.count, "page", "searchDialog", null, null);
                if (data.count == 0) {
                    $("#page").css("display","none");
                } else {
                    $("#page").css("display","block");
                }
            }
            
		}
	};
	exeAjax(
			ajaxUrl("${aier_url}${aier_urijs}userhscb_searchTDialogList${aier_suffix}"),
			fun, {
				"tid" : global_tid,
				"cid" : global_cid,
				"page":dpage,
				"page_size":page_size
			});
}

$("#remark").click(function() {
    curTab = 3;
    searchAppraise(rpage);
});
// 获取评语列表
function searchAppraise(nowpage) {
    rpage = nowpage;
    var fun = function(data) {
        if (data.s == 1) {
            // 刷新评语列表
            var html = "";
            if (data.appraiseList != null) {
                for ( var i = 0; i < data.appraiseList.length; i++) {
                    var appraise = data.appraiseList[i];
                    html += '<dl class="clearfix"><dt><a class="fd-actor" href=""><img width="50" height="50" src="${get_picturl_url}small/'+appraise.headimg+'"></a></dt>';
                    html += '<dd class="fd-right" data-apid="'+appraise.apid+'">';
                    html += '<div class="fd-top"><a href="">'
                            + appraise.tname + '老师</a> 发送给 <a href="">'
                            + appraise.bname + '</a> 的评语<br><div>'
                            + appraise.content + '</div></div>';
                    
                    var mes = "";
                    if (!isnull(appraise.successStr)) {
                        mes = "短信发送成功用户："+appraise.successStr;
                        if (!isnull(appraise.failStr)) {
                            mes = mes + "; 短信发送失败用户："+appraise.failStr;
                        }
                    } else {
                        if (!isnull(appraise.failStr)) {
                            mes = mes + "短信发送失败用户："+appraise.failStr;
                        }
                    }
                    html += '<p class="fd-message">'+mes+'</p>'; //短信成功和失败     
                    html += '<p class="fd-bottom"><span class="fd-actions"><a href="javascript:;" data-action="replyIt" id="replyCount_1399030" data-count="4">回复(<em>'
                            + appraise.acList.length
                            + '</em>)</a></span><span class="time">'
                            + appraise.cdate.split("T")[0]
                            + " "
                            + appraise.cdate.split("T")[1] + '</span></p>';

                    if (appraise.acList != null && appraise.acList.length != 0) {
                        html += '<div id="commentPanel_0" class="comment"><div id="commentList_0" class="comment_list ">';
                        for ( var j = 0; j < appraise.acList.length; j++) {
                            var ac = appraise.acList[j];
                            html += '<dl><dt><a href=""><img src="${get_picturl_url}small/'+ac.headimg+'" width="40" height="40" data-card="" alt=""></a></dt><dd class="ml50"><a href="">'
                                    + ac.cname
                                    + '</a><span class="time">'
                                    + ac.cdate.split("T")[0]
                                    + " "
                                    + ac.cdate.split("T")[1] + '</span>';
                            html += '<a href="javascript:;" data-action="replyComment" data-cid="287736" data-cuid="" data-fromuser="" class="reply">回复</a><div class="content mt5"><div>'
                                    + ac.content
                                    + '</div><div class="media_pre"></div></div></dd></dl>';
                        }
                        html += '</div>';
                    }
                    html += '<div class="sj"></div><input type="text" class="txt_ipt" value="我要回复" data-action="showInputBox"><div style="display: none;" class="comment_input_box"><div class="txt_wrap"><textarea id = "acText"></textarea></div><div class="after_text"><a data-action="reply" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only fr" role="button" aria-disabled="false"><span class="ui-button-text">发表</span></a></div></div></div></dd></dl>';


                }
            }
            
            $("#appraise").html(html);
            $(".txt_ipt").focus(function() {
            	$(this).hide();
            	$(this).closest('.fd-right').find('.comment_input_box').show();
            	$(this).closest('.fd-right').find('.comment_input_box textarea').focus();
            });
            
            // 评语回复
		    $('.fr').click(function() {
               var apid = $(this).closest('.fd-right').attr("data-apid");
               var content = $(this).closest('.fd-right').find('.comment_input_box textarea').val();
		       if (isnull(content)) {
		            $().message("请输入回复内容！");
		            return;
		        }
		        var fun = function(data) {
		            if (data.s == 1) {
		                $("#acText").val("");
		                // 刷新评语列表
		                searchAppraise(rpage);
		            }
		        };
		        exeAjax(
		                ajaxUrl("${aier_url}${aier_urijs}userhscb_commentAppraise${aier_suffix}"),
		                fun, {
		                    "apid" : apid,
		                    "type" : 1,
		                    "content" : content,
		                    "tid":global_tid
		                });
		
		    });
            // 更新分页显示
            if (curTab == 3) {
                rpage = data.page;
                toLoadPage(rpage, page_size, data.page_count, data.count, "page", "searchAppraise", null, null);
                if (data.count == 0) {
                    $("#page").css("display","none");
                } else {
                    $("#page").css("display","block");
                }
            }
            
        }
    };
    exeAjax(
            ajaxUrl("${aier_url}${aier_urijs}userhscb_searchTAppraiseList${aier_suffix}"),
            fun, {
                "tid" : global_tid,
                "cid" : global_cid,
                "page":rpage,
                "page_size":page_size
            });
}

$("#task").click(function() {
    curTab = 1;
    searchHomework(tpage);
});
    
    
    
    
    
// 查询作业列表
function searchHomework(nowpage) {
    tpage = nowpage;
    var fun = function(data) {
        if (data.s == 1) {
        	$("#homework").html("");
            // 作业列表
            if (data.hwList != null) {
                for ( var i = 0; i < data.hwList.length; i++) {
                	var html = '<dl class="dldldl clearfix" data-mid="" data-srxtype="work"><dt><a class="fd-actor" href=""><img width="50" height="50" data-card="392166" src="" alt="头像"></a></dt><dd class="fd-right" data-hid="3"><div class="fd-top"><span class="new"><a href=""></a>布置了作业</span><div class="homework-content"></div></div><div class="fd-media-pre"><div class="feed_media"><span data-action="showMediaBox"><a href="" target="_blank"><img src="" class="small_pic"></a></span></div></div><p class="fd-message"></p><p class="fd-bottom"><span class="fd-actions"><a href="javascript:;" data-action="replyIt" data-count="4">回复(<em></em>)</a></span><span class="time"></span></p><div class="comment"><div class="comment_list "></div><div class="comment_input_box"><div class="txt_wrap"><textarea class="border-box"></textarea></div><div class="after_text"><a href="javascript:;" class="aaa">图片</a><a data-action="reply" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only fr" role="button" aria-disabled="false"><span class="ui-button-text">发表</span></a></div></div></div></dd></dl>';
					$("#homework").append(html);

	                $('.aaa').click(function(event) {
	                    event.stopPropagation();
	                });
	
	                
	                $(".aaa").click(function() {
	                    $('#uploadPhotoBox').show();
	                    var boxTop = $(this).offset().top + $(this).height() + 8,
	                        boxLeft= $(this).offset().left;
	                    
	                    $('#uploadPhotoBox').css({
	                        top: boxTop,
	                        left: boxLeft
	                   });
	                 
	                });
					
					var target = $('#homework').children('.dldldl').last();
					
					target.find('.comment_list dl').remove(); // 移除回复列表
                	var hw = data.hwList[i]; //获取数据
                	/* 插入数据 */
                	target.find('dt a img').attr('src',"${get_picturl_url}small/"+hw.headimg);  //头像
                	target.children('.fd-right').attr('data-hid',hw.hid);  	     // 作业id
                	target.find('.fd-right .fd-top span a').text(hw.tname+"老师"); // 老师昵称
                	target.find('.fd-right .homework-content').html(hw.content);   // 作业内容，可以先解析
                	target.find('.fd-bottom .fd-actions a em').text(hw.hcList.length); //回复数
                	target.find('.fd-bottom .time').text(hw.cdate.split("T")[0] + " " + hw.cdate.split("T")[1]);
                	
                	var mes = "";
                	if (!isnull(hw.successStr)) {
                		mes = "短信发送成功用户："+hw.successStr;
                		if (!isnull(hw.failStr)) {
                			mes = mes + "; 短信发送失败用户："+hw.failStr;
                		}
                	} else {
                		if (!isnull(hw.failStr)) {
                            mes = mes + "短信发送失败用户："+hw.failStr;
                        }
                	}
                	target.find('.fd-message').text(mes); //短信成功和失败
                	
                	
                    if (!isnull(hw.img)) {
                    	target.find('span[data-action="showMediaBox"] a').attr('href',"${homework_get_url}origin/"+hw.img) // 原始图跳转
                       		.children('img').attr('src',"${homework_get_url}small/"+hw.img); //缩略图
                    } else {
                    	target.find('.fd-media-pre').remove(); // 移除作业公告中的图片
                    }
                	
                    // 一级评论列表
                	if (hw.hcList != null && hw.hcList.length != 0) {
                		for ( var j = 0; j < hw.hcList.length; j++) {
                			var hc = hw.hcList[j];
                			var htmlB =  '<dl data-chid=""><dt><a href=""><img src="" width="40" height="40" data-card="" alt=""></a></dt><dd class="ml50"><a href="">昵称</a><span class="time">0000-09-17 17:26:37</span><a href="javascript:;" data-action="replyComment" data-cid="" data-cuid="" data-fromuser="" class="reply">回复</a><div class="content mt5"><div>23</div><a href="" target="_blank" class="comment-img"><img src=""></a></div></dd></dl>'; // 获取回复列表模版
                			target.find('.comment_list').append(htmlB);// 插入数据
                			var targetB = target.find('.comment_list').children('dl').last();
                			targetB.attr('data-chid',hc.chid);
                			targetB.find('dt img').attr('src',"${get_picturl_url}small/"+hc.headimg);
                			targetB.find('.ml50 a:eq(0)').text(hc.cname);
                			targetB.find('.time').text(hc.cdate.split("T")[0] + " " + hc.cdate.split("T")[1]);
                			targetB.find('.content>div:eq(0)').html(hc.content);
                			
                			if (!isnull(hc.img)) {
                				targetB.find('.content>.comment-img').attr('href',"${homework_get_url}origin/"+hc.img)
                					.children('img').attr('src',"${homework_get_url}small/"+hc.img);
                			} else {
                				targetB.find('.content>.comment-img').remove(); // 移除回复中的图片
                			}
                			
                		}
                	}
                } // end for
                clickCommentII();
            }
            
            // 作业一级评论
            $('.fr').click(function() {
               var hid = $(this).closest('.fd-right').attr("data-hid");
               var content = $(this).closest('.fd-right').find('.comment_input_box textarea').val();

		        if (isnull(content)&&isnull(hwImg)) {
		            $().message("请输入回复内容！");
		            return;
		        }
		        var fun = function(data) {
		            if (data.s == 1) {
		                $("#hcText").val("");
		                hwImg = "";
		                $('#confirmPhoto').hide();
		                $('#selectPhoto').val("");
		                $('#photoName').html("");
		                $('.select').show();
		                // 刷新作业列表
		                $("#homework").html('');
		                searchHomework(tpage);
		            }
		        };
		        exeAjax(
		                ajaxUrl("${aier_url}${aier_urijs}userhscb_commentHomework${aier_suffix}"),
		                fun, {
		                    "hid" : hid,
		                    "type" : 1,
		                    "content" : content,
		                    "imageName":hwImg,
		                    "tid":global_tid
		                });
		    });
		    // 更新分页显示
		    if (curTab == 1) {
			    tpage = data.page;
                toLoadPage(tpage, page_size, data.page_count, data.count, "page", "searchHomework", null, null);
                if (data.count == 0) {
                    $("#page").css("display","none");
                } else {
                    $("#page").css("display","block");
                }
		    }
		    
        }
    };
    exeAjax(
            ajaxUrl("${aier_url}${aier_urijs}userhscb_searchTHomework${aier_suffix}"),
            fun, {
                "cid" : global_cid,
                "page":tpage,
                "page_size":page_size
            });
    
} // end 查询作业列表
    
    
    
$("#bulletin").click(function() {
    curTab = 2;
    searchSchoolMessage(bpage);
});
    
//查询公告
function searchSchoolMessage(nowbpage){
    bpage = nowbpage;						
    var fun = function(data) {
    	var meghtml = "";
        if (data.s == 1) {
            for(var i=0;i<data.schoolMessageList.length;i++) {
              	var name_teacher = data.schoolMessageList[i].name_teacher;
              	var headimg_teacher = data.schoolMessageList[i].headimg_teacher;
 				var message = data.schoolMessageList[i].message;
 				var ctime_str = data.schoolMessageList[i].ctime_str;
 				var type_m = data.schoolMessageList[i].type;
 				var img = data.schoolMessageList[i].img;
 				var tid = data.schoolMessageList[i].tid;
 				var type_str = "班级公告";
 				if(type_m==0){
 					type_str = "校园公告";
 				};
 				var successStr = data.schoolMessageList[i].successStr;
 				var failStr = data.schoolMessageList[i].failStr;
 				meghtml += "<div class='fd-item'><dl class='clearfix'><dt><a class='fd-actor' href=''> <img width='50' height='50' data-card='392161'"+
 					"src='${get_picturl_url}small/"+headimg_teacher+"' alt='"+name_teacher+"' title='"+name_teacher+"'> </a></dt>"+
 					"<dd class='fd-right'><div class='fd-top'><span><a href=''>"+name_teacher+"老师</a>发布了"+type_str+"</span>"+
 					"<div>"+message+"</div>";
 				// 有图片
                if (!isnull(img)) {
                    meghtml += "<div class='feed_media'><span data-action='showMediaBox'><a href='${homework_get_url}origin/"+
                    img+"' target='_blank'><img src='${homework_get_url}small/"+img+"' class='small_pic'></a></span></div>";
                }
                meghtml += "</div>";
                
                if (type_m != 0) {
                	var mes = "";
                    if (!isnull(successStr)) {
                        mes = "短信发送成功用户："+successStr;
                        if (!isnull(failStr)) {
                            mes = mes + "; 短信发送失败用户："+failStr;
                        }
                    } else {
                        if (!isnull(failStr)) {
                            mes = mes + "短信发送失败用户："+failStr;
                        }
                    }
                    meghtml += "<p class='fd-message'>"+mes+"</p>"; //短信成功和失败
                }
                
                meghtml += "<p class='fd-bottom'><span class='time'>"+ctime_str+"</span></p></dd>";
                if (global_tid == tid) {
                    meghtml += "<div class='xxs-screen'><a href='javascript:void(0);' class='btn-screen-delete' onclick='deleteMessage("+data.schoolMessageList[i].mid+");'>x</a></div>";
                }
                meghtml += "</dl></div>";
 			}
 			// 更新分页显示
 			if (curTab == 2) {
 			    bpage = data.page;
                toLoadPage(bpage, page_size, data.page_count, data.count, "page", "searchSchoolMessage", null, null);
                if (data.count == 0) {
                    $("#page").css("display","none");
                } else {
                    $("#page").css("display","block");
                }
 			}
        };
        $("#userBulletin").html(meghtml);
    };
    exeAjax(
            ajaxUrl("${aier_url}${aier_urijs}userhscb_searchSchoolMessageList${aier_suffix}"),
            fun, {
                "tid" : global_tid,
                "cid" : global_cid,
                "page":bpage,
                "page_size":page_size
            });   
}
    
// 查询进出园记录
$("#record").click(function() {
    curTab = 4;
    $("#page").css("display","none");
    searchStuIcardInfoList();
});
    
// 上传图片

$("body").click(function(){
 	$("#uploadPhotoBox").hide();
});

$('.upload_img,#uploadPhotoBox').click(function(event) {
    event.stopPropagation();
});

$(".upload_img").click(function() {
	
 	var boxTop = $(this).offset().top + $(this).height() + 8,
 		boxLeft= $(this).offset().left;
 	
    $('#uploadPhotoBox').css({
   	 top: boxTop,
        left: boxLeft
   });
 
    $('#uploadPhotoBox').toggle();

});


$("#selectPhoto").live('change', function(){
	upfile();
	$(".select").hide();
	$(".uploading").show();
});
	
function upfile() {
    var temp = $('#selectPhoto').val().substring($('#selectPhoto').val().lastIndexOf('.')).toLowerCase();
	try {$.ajaxFileUpload({
		url : "${aier_url}commonjs/image_uploadImage${aier_suffix}?photoName="+temp+"&&imageUrl=${homework_upload_url}&&type=1",
        secureuri : false,
		fileElementId : 'selectPhoto',
		dataType : 'json',
		success : function(data, status) {
		    if (data.s == 1) {
			    hwImg = data.imageName;
                $(".uploading").hide();
                $('#confirmPhoto').show();
                $('#photoName').html(hwImg);
		    } else {
		        $().message("图片上传出错，请重新上传！");
		        $(".uploading").hide();
                $('.select').show();
		    }
			
		},
		error : function(data, status, e) {
			$().message("服务器连接超时");
			
		}
	});
	} catch (e) {
		$(".uploading").hide();
		$('.select').show();
		$().message("服务器连接超时");
	}
};
	
// 删除图片
$("#delete").click(function(){
   
     var fun=function(data){
        if(data.s==1){
            hwImg = "";
            $('#confirmPhoto').hide();
            $('#selectPhoto').val("");
            $('#photoName').html("");
            $('.select').show();
        } else {
            $().message("删除失败，请稍后再试！"); 
        }
    };
    exeAjax(
         ajaxUrl("${aier_url}${aier_urijs}userhomeforums_deleteImage.shtml"),
         fun,{
             "imageName":hwImg
    });
    
});
	
	
$("#daily").click(function() {
   $("#page").css("display","none");
});


//将点击的评语显示到评语输入框
$("#demoRemark a").click(function(){
	$("#commentText").append($(this).text());
});
	
	
	
	
	
	
// Z000056 2013-09-23

function clickCommentII() {
	
	$('.ml50 .reply').click(function(){

		var $target = $(this).parent('.ml50');
		if ($target.hasClass('replying')) {
			$target.removeClass('replying');
			$target.children('.usb-hw-comment-ii').remove();
		} else {
			$target.addClass('replying');
			searchCommentII($target);
		}
	});
}

function searchCommentII($target) {
	// ajax过程

	var commentii = '<div class="usb-hw-comment-ii"><div class="comment-textbox"><div class="edit"><textarea class="border-box"></textarea></div><div class="func clearfix"><a class="btn btn-reply btn-orange-2"><span>回复</span></a></div></div><div class="comment-list-ii"><div class="comment-item-ii clearfix"><div class="avatar"><a href=""><img src="" alt=""></a></div><div class="name"><a href=""><span class="nickname"></span></a><span class="birthtime"></span></div><div class="words"></div></div></div></div>'; // 模版文件
	var $cmtall = $(commentii); // dom,子回复（框+列表）
	$cmtall.find('.comment-item-ii').remove(); // 清空子回复列表
    var chid = $target.parent('dl').attr('data-chid');
	// 插数据过程
	var fun = function(data) {
        if (data.s == 1) {
        	if (data.hcrList != null) {
        		$target.append($cmtall); // 先输出不包含子回复列表的html
                /* 子回复列表>0 */
                var $targetList = $target.find('.comment-list-ii');
                for (var i = 0; i < data.hcrList.length; i++) {
                	var $cmtitem = $(commentii).find('.comment-item-ii'); // dom,单个子回复项目
                    var hcr = data.hcrList[i];
                    // 插数据过程
                    $cmtitem.find('.avatar img').attr('src',"${get_picturl_url}small/"+hcr.headimg);
                    $cmtitem.find('.name .nickname').text(hcr.cname);
                    $cmtitem.find('.name .birthtime').text(hcr.cdate.split("T")[0]+ " "+hcr.cdate.split("T")[1]);
                    $cmtitem.find('.words').text(hcr.content);

                    $targetList.prepend($cmtitem); // 输出子回复列表
                };
        	}
            
        }
        replyCommentII(commentii,chid,$target);
    };
    exeAjax(
            ajaxUrl("${aier_url}${aier_urijs}userhscb_searchHWCReply${aier_suffix}"),
            fun, {
                "chid" : chid
            });

	
}

function replyCommentII(commentii,chid,$target) {
	$target.find('.btn-reply').click(function(){
		var $this = $(this);
		var words = $this.parents('.comment-textbox').find('textarea').val();
		if (isnull(words)) {
            $().message("请输入回复内容！");
            return;
        }
		var fun = function(data) {
	        if (data.s == 1 && data.hcr != null) {
	        	$this.parents('.comment-textbox').find('textarea').val("");
	        	var $list = $this.parents('.usb-hw-comment-ii').find('.comment-list-ii');
	        	var $cmtitem = $(commentii).find('.comment-item-ii');
	        	
	        	// 插数据过程
                $cmtitem.find('.avatar img').attr('src',"${get_picturl_url}small/"+data.hcr.headimg);
                $cmtitem.find('.name .nickname').text(data.hcr.cname);
                $cmtitem.find('.name .birthtime').text(data.hcr.cdate.split("T")[0]+ " "+data.hcr.cdate.split("T")[1]);
                $cmtitem.find('.words').text(data.hcr.content);
                $list.prepend($cmtitem);
	        }
	    };
	    exeAjax(
	            ajaxUrl("${aier_url}${aier_urijs}userhscb_replyComment${aier_suffix}"),
	            fun, {
	                "chid" : chid,
	                "content":words,
	                "type":1,
	                "tid":global_tid
	            });
		
	});
}

//删除公告
function deleteMessage(mid) {
    $(function() {
        $("#deleteConfirm").dialog(
            {
                //背景变暗
                modal : true,
                autoOpen : false,
                show : "fade",
                hide : "fade",
                width : "340",
                height : "220",
                buttons : {
                    "确定" : function() {
                        // 获取公告列表
                        var fun=function(data){
                            if(data.s==1){
                                $("#deleteConfirm").dialog("close");
                                searchSchoolMessage(bpage);
                            } else {
                                $("#deleteConfirm").dialog("close");
                                $().message("删除失败，请稍后再试！");
                            }
                            
                        };
                        exeAjax(
                             ajaxUrl("${aier_url}${aier_urijs}userhscb_deleteMessage${aier_suffix}"),
                             fun,{
                                "mid":mid
                        });
                                        },
                    "取消" : function() {
                        $(this).dialog("close");
                    }
            }
        });
        $("#deleteConfirm").dialog("open");
    });
    
}


</script>
</html>